import qs from 'query-string';

const historyFullPath = () => {
  return window.history.state.back;
};

const historyPath = () => {
  const back = window.history.state.back;

  if (back) {
    const { url } = qs.parseUrl(back);
    return url;
  }
  return null;
};

// eslint-disable-next-line import/prefer-default-export
export { historyFullPath, historyPath };
